<div>
<div style="float: left;margin-top: 50px;">
<div class="hd">
    <h3>大学经历</h3>

    <div class="dashed"></div>
</div>
<div class="bd">
    <ul class=" js_left_list" id="group_list">
        <volist name="school" id="vo">
            <li rel="-2" id="group__2" class="grouplist1" style="float: left">
                <div style="width: 700px; margin-top: 10px;">
                    <div style="float: left;">
                        <div class="txt_schoolname">{$vo.sname} {$vo.entrance_year} {$vo.stype}</div>
                        <div style="color: #8c8c8c;">就读{$vo.institute}</div>
                    </div>
                    <div style="float: right">
                        <a id="edit{$vo.id}" onclick="showedit('{$vo.id}')" class="act-edit a "
                           style=" ">编辑</a>
                        <a id="del{$vo.id}" onclick="delcollege('{$vo.id}')" class="act-edit a "
                           style=" ">删除</a>
                    </div>


                </div>

            </li>
        </volist>
    </ul>
</div>
<div class="clearfix"></div>
<div style="margin-top: 20px;float: left">

    <div onclick="showdiv()" id="creat_school" class="btn_creat placeholder"><span class="xpy-icon je-ico-add"></span>添加大学经历
    </div>


    <div style="background: #f2f6f9; width: 600px;">

        <div class="group-action group-edit" id="creat_school_div"
             style="display: none;width: 700px;padding: 20px 12px 50px 75px;">

            <div style="">
                <div class="clearfix"></div>
                <div class="kong">
                    <div class="tt" style="float: left"> 在该校读：</div>
                    <div class="">
                        <label><input name="ctype" type="radio" value="1" class=""/>本科</label>
                        <label><input name="ctype" type="radio" value="2" class=""/>硕士</label>
                        <label><input name="ctype" type="radio" value="3" class=""/>博士</label>
                        <label><input name="ctype" type="radio" value="4" class=""/>专科或高职</label>
                    </div>
                </div>
                <!--选择学校-->
                <div class="kong">
                    <div class="tt" style="float: left">大学名称：</div>
                    <div class="form-row">
                        <div style="*height:30px;overflow:hidden;*zoom:1;">
                            <span id="show_school1" style="line-height:24px;font-size: 14px"></span>
                            <a id="btn_school1" href="javascript:;"
                               style="line-height:24px;font-size: 14px;margin-right: 10px"
                               onclick="">选择</a>
                            <input type="hidden" name="school" event-node="school" event-args="error=必须选择学校"
                                   id="school_id1" value="0"/>

                            <div id="school_box1" style="display: none;">
                                <div style="width:610px;padding: 20px;">
                                    <div class="mb10" style="clear:right;">
                                        <ul id="myarea1">
                                            <volist name="school_area" id="v">
                                                <li><a style="font-size: 12px" href="javascript:;"
                                                       onclick="load_school1('{$v.school_id}')">{$v.name}</a>
                                                </li>
                                            </volist>
                                        </ul>
                                        <div style="clear:both"></div>
                                    </div>
                                    <div class="clearfix"
                                            ></div>
                                    <div style="clear: left">
                                        <ul id="school1"></ul>
                                    </div>
                                </div>
                                <div class="clearfix">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--选择学校结束-->
                <div class="clearfix"></div>

                <div class="kong">
                    <div class="tt" style="float: left">入学年份：</div>
                    <select name="year" id="cyear">

                        <volist name="year" id="v2">
                            <option name="{$v2}">{$v2}</option>
                        </volist>
                    </select>
                </div>
                <div class="kong">
                    <div class="tt" style="float: left">院系名称：</div>
                    <div><input name="institute" id="cinstitute" autocomplete="off" type="text" value=""/></div>
                </div>
            </div>

            <p class="act" style="margin-top: 10px;">

                <input onclick="add_school()" class="btn_add" type="submit" value="添加"/>
                <input onclick="hidediv()" class="btn_add" type="submit" value="取消"/>

            </p>
        </div>


        <volist name="school" id="vo">
            <div class="group-action group-edit" id="edit_school_div{$vo.id}"
                 style="display: none;width: 700px;padding: 20px 12px 50px 75px;">

                <div style="">
                    <div class="clearfix"></div>
                    <div class="kong">
                        <div class="tt" style="float: left"> 在该校读：</div>
                        <div class="">
                            <label><input name="type{$vo.id}" type="radio" value="1" class=""
                                <if condition="1 eq $vo['type']">checked="checked"</if>
                                />本科</label>
                            <label><input name="type{$vo.id}" type="radio" value="2" class=""
                                <if condition="2 eq $vo['type']">checked="checked"</if>
                                />硕士</label>
                            <label><input name="type{$vo.id}" type="radio" value="3" class=""
                                <if condition="3 eq $vo['type']">checked="checked"</if>
                                />博士</label>
                            <label><input name="type{$vo.id}" type="radio" value="4" class=""
                                <if condition="4 eq $vo['type']">checked="checked"</if>
                                />专科或高职</label>
                        </div>
                    </div>
                    <!--选择学校-->
                    <div class="kong">
                        <div class="tt" style="float: left">大学名称：</div>
                        <div class="form-row">
                            <div style="padding:3px 0 0 0;*height:30px;overflow:hidden;*zoom:1;">
                                <span id="show_school" style="line-height:24px;font-size: 14px">{$vo.sname}</span>
                                <a id="btn_school" href="javascript:;"
                                   style="line-height:24px;font-size: 14px;margin-right: 10px"
                                   onclick="">选择</a>
                                <input type="hidden" name="school" event-node="school" event-args="error=必须选择学校"
                                       id="school_id" value="0"/>
                                <input type="hidden" name="old_school}" event-node="school" event-args="error=必须选择"
                                       id="old_school_id" value="{$vo.school_id}"/>

                                <div id="school_box" style="display: none;">
                                    <div style="width:610px;padding: 20px;">
                                        <div class="mb10" style="clear:right;">
                                            <ul id="myarea">
                                                <volist name="school_area" id="v">
                                                    <li><a style="font-size: 12px" href="javascript:;"
                                                           onclick="load_school('{$v.school_id}')">{$v.name}</a>
                                                    </li>
                                                </volist>
                                            </ul>
                                            <div style="clear:both"></div>
                                        </div>
                                        <div class="clearfix"
                                                ></div>
                                        <div style="clear: left">
                                            <ul id="school"></ul>
                                        </div>
                                    </div>
                                    <div class="clearfix">
                                    </div>
                                </div>


                            </div>
                        </div>
                    </div>
                    <!--选择学校结束-->

                    <div class="clearfix"></div>
                    <div class="kong">
                        <div class="tt" style="float: left">入学年份：</div>
                        <select name="year" id="year">

                            <volist name="year" id="v">
                                <option name="{$v}"
                                <if condition="$v eq $vo['entrance_year']">selected="selected"</if>
                                >{$v}</option>
                            </volist>
                        </select>
                    </div>
                    <div class="kong">
                        <div class="tt" style="float: left">院系名称：</div>
                        <div><input name="institute" id="institute" autocomplete="off" type="text"
                                    value="{$vo['institute']}"/></div>
                    </div>
                </div>

                <p class="act" style="margin-top: 10px;" >

                    <input onclick="edit_school('{$vo.id}')" class="btn_add" type="submit" value="保存"/>
                    <input onclick="hideeditdiv('{$vo.id}')" class="btn_add" type="submit" value="取消"/>

                </p>
            </div>

        </volist>

    </div>


</div>
</div>
</div>

<script>
    function edit(gid) {
        $(".grouplist1 .act-edit").hide();
        $(".group-edit").hide();
        document.getElementById('edit' + gid).style.display = " block";
    }
    function showdiv() {
        document.getElementById("creat_school_div").style.display = " block";
        document.getElementById("creat_school").style.display = " none";
    }
    function hidediv() {
        document.getElementById("creat_school_div").style.display = " none";
        document.getElementById("creat_school").style.display = " block";
    }
    function hideeditdiv(id) {
        document.getElementById("edit_school_div" + id).style.display = " none";
        document.getElementById("creat_school").style.display = " block";
    }

    function showedit(id) {

        document.getElementById("edit_school_div" + id).style.display = " block";
        document.getElementById("creat_school").style.display = " none";
        document.getElementById("creat_school_div").style.display = " none";

    }
    function edit_school(id) {

        $.post(U("friend/Info/editcollege"), { type: $("input[name='type" + id + "']:checked").val(), id: id, education: 'college', school: $('#school_id').val(), old_school: $('#old_school_id').val(), year: $("#year").val(), institute: $('#institute').val()}, function (data) {
            if (data.status == 1) {
                ui.success('修改成功！')
            }
            $('#college_list').load(U("friend/Info/_college"));

        }, 'json');
    }
    function add_school() {

        $.post(U("friend/Info/addcollege"), { type: $("input[name='ctype']:checked").val(), education: 'college', school: $('#school_id1').val(), year: $("#cyear").val(), institute: $('#cinstitute').val()}, function (data) {
            if (data.status == 1) {
                ui.success('添加成功！')
            }
            $('#college_list').load(U("friend/Info/_college"));

        }, 'json');
    }
    function delcollege(id) {
        $.post(U("friend/Info/delcollege"), { id: id}, function (data) {
            if (data.status == 1) {
                ui.success('删除成功！')
            }
            location.reload()
        }, 'json');
    }
</script>

<script>
    $('#btn_school').click(function () {
        mybox = ui.box.show($('#school_box').html(), '选择学校', function () {
        });
        $('.boxy-modal-blackout').css({position: 'fixed'});
    });
    function load_school(pid) {
        $('#school').load("{:U('friend/Info/_school')}", {pid: pid});
    }
    function set_school(sid, sname) {
        ui.box.close();
        $('#school_id').val(sid);
        $('#show_school').text(sname);
    }

    $('#btn_school1').click(function () {
        mybox = ui.box.show($('#school_box1').html(), '选择学校', function () {
        });
        $('.boxy-modal-blackout').css({position: 'fixed'});
    });
    function load_school1(pid) {
        $('#school1').load("{:U('friend/Info/_school1')}", {pid: pid});
    }
    function set_school1(sid, sname) {
        ui.box.close();
        $('#school_id1').val(sid);
        $('#show_school1').text(sname);
    }
</script>

<style>

</style>